Processor having real-time power conservation

ABSTRACT

An apparatus having a processing unit and a monitor for monitoring activity associated with said processing unit. The monitor enables selective lowering of the frequency of clock signals, or stopping and starting of clock signals, being received by said processing unit in response to a changing level of activity associated with said processing unit.

This application is a Continuation of application Ser. No. 10/375,982,filed Feb. 28, 2003, which is a Continuation of application Ser. No.10/074,739, filed Feb. 11, 2002, now U.S. Pat. No. 6,633,988 which is aContinuation of application Ser. No. 09/756,838, filed Jan. 9, 2001, nowU.S. Pat. No. 6,397,340 which is a Continuation of application Ser. No.09/392,205, filed Sep. 8, 1999, now U.S. Pat. No. 6,173,409 which is aContinuation of application Ser. No. 08/023,831, filed Feb. 23, 1993,now U.S. Pat. No. 6,006,336 which is a Continuation of application Ser.No. 07/429,270 filed Oct. 30, 1989, now U.S. Pat. No. 5,218,704.

BACKGROUND OF THE INVENTION

1. Field of the Invention

This invention relates to real-time computer power conservation, andmore particularly to an apparatus and method for reduction of centralprocessing unit (CPU) clock time based on the real-time activity levelwithin the CPU of a portable computer.

2. Description of the Related Art

During the development stages of personal computers, the transportableor portable computer has become very popular. Such portable computeruses a large power supply and really represents a small desktop personalcomputer. Portable computers are smaller and lighter than a desktoppersonal computer and allow a user to employ the same software that canbe used on a desktop computer.

The first generation “portable” computers only operated from an A/C wallpower. As personal computer development continued, battery-poweredcomputers were designed. Furthermore, real portability became possiblewith the development of new display technology, better disk storage, andlighter components.

However, the software developed was designed to run on desk top personalcomputers, with all the features of desk top computers, without regardto battery-powered portable computers that only had limited amounts ofpower available for short periods of time. No special considerationswere made by the software, operating system (MS-DOS), Basic Input/OutputSystem (BIOS), or the third party application software to conserve powerusage for these portable computers.

As more and more highly functional software packages were developed,desk top computer users experienced increased performance from theintroductions of higher computational CPUs, increased memory, and fasterhigh performance disk drives.

Unfortunately, portable computers continued to run only on A/C power orwith large and heavy batteries. In trying to keep up with theperformance requirements of the desk top computers, and the newsoftware, expensive components were used to cut the power requirements.Even so, the heavy batteries still did not run very long. This meantusers of portable commuters had to settle for A/C operation or veryshort battery operation to have the performance that was expected fromthe third party software.

Portable computer designers stepped the performance down to 8088- and8086-type processors to reduce the power consumption. The supportingcircuits and CPU took less power to run and therefore, lighter batteriescould be used. Unfortunately, the new software requiring 80286-typeinstructions, that did not exist in the older slower 8088/8086 CPUs, didnot run.

In an attempt to design a portable computer that could conserve power,thereby yielding longer battery operation, smaller units, and lessweight, some portable computer designers proceeded to reduce powerconsumption of a portable computer while a user is not using thecomputer. For example, designers obtain a reduction in power usage byslowing or stopping the disk drive after some predetermined period ofinactivity; if the disk drive is not being used, the disk drive isturned off, or simply placed into a standby mode. When the user is readyto use the disk, the operation must wait until the disk drive spins upand the computer system is ready again for full performance before theoperator may proceed with the operation.

Other portable computer designers conserve power by turning the computerdisplay off when the keyboard is not being used. However, in normaloperation the computer is using full power. In other words, powerconservation by this method is practical only when the user is not usingthe components of the system. It is very likely, however, that the userwill turn the computer off when not in use.

Nevertheless, substantial power conservation while the operator is usingthe computer for meaningful work is needed. When the operator uses thecomputer, full operation of all components is required. During theintervals while the operator is not using the computer, however, thecomputer could be turned off or slowed down to conserve powerconsumption. It is critical to maintaining performance to determine whento slow the computer down or turn it off without disrupting the user'swork, upsetting the third party software, or confusing the operatingsystem, until operation is needed.

Furthermore, although an user can wait for the disk to spin up asdescribed above, application software packages cannot wait for the CPUto “spin up” and get ready. The CPU must be ready when the applicationprogram needs to compute. Switching to full operation must be completedquickly and without the application program being affected. Thisimmediate transition must be transparent to the user as well as to theapplication currently active. Delays cause user operational problems inresponse time and software compatability, as well as general failure bythe computer to accurately execute a required program.

Other attempts at power conservation for portable computers includeproviding a “Shut Down” or “Standby Mode” of operation. The problem,again, is that the computer is not usable by the operator during thisperiod. The operator could just as well turned off the power switch ofthe unit to save power. This type of power conservation only allows theportable computer to “shut down” and thereby save power if the operatorforgets to turn off the power switch, or walks away from the computerfor the programmed length of time. The advantage of this type of powerconservation over just turning the power switch off/on is a much quickerreturn to full operation. However, this method of power conservation isstill not real-time, intelligent power conservation while the computeris on and processing data which does not disturb the operating system,BIOS, and any third party application programs currently running on thecomputer.

Attempts to meet this need have been made by VLSI vendors in providingcircuits that either turn off the clocks to the CPU when the user is nottyping on the keyboard or wakes up the computer on demand when akeystroke occurred. Either of these approaches reduce power but thecomputer is dead (unusable) during this period. Background operationssuch as updating the system clock, communications, print spooling, andother like operations cannot be performed. Some existing portablecomputers employ these circuits. After a programmed period of noactivity, the computer turns itself off. The operator must turn themachine on again but does not have to reboot the operating system andapplication program. The advantage of this circuitry is, like theexisting “shut down” operations, a quick return to full operationwithout restarting the computer. Nevertheless, this method only reducespower consumption when the user walks away from the machine and does notactually extend the operational life of the battery charge.

SUMMARY OF THE INVENTION

In view of the above problems associated with the related art, it is anobject of the present invention to provide an apparatus and method forreal-time conservation of power for computer systems without anyreal-time performance degradation, such conservation of power remainingtransparent to the user.

Another object of the present invention is to provide an apparatus andmethod for predicting the activity level within a computer system andusing the prediction for automatic power conservation.

Yet another object of the present invention is to provide an apparatusand method which allows user modification of automatic activity levelpredictions and using the modified predictions for automatic powerconservation.

A further object of the present invention is to provide an apparatus andmethod for real-time reduction and restoration of clock speeds therebyreturning the CPU to full processing rate from a period of inactivitywhich is transparent to software programs.

These objects are accomplished in a preferred embodiment of the presentinvention by an apparatus and method which determine whether a CPU mayrest based upon the CPU activity level and activates a hardware selectorbased upon that determination. If the CPU may rest, or sleep, thehardware selector applies oscillations at a sleep clock level; if theCPU is to be active, the hardware selector applies oscillations at ahigh speed clock level.

The present invention examines the state of CPU activity, as well as theactivity of both the operator and any application software programcurrently active. This sampling of activity is performed real-time,adjusting the performance level of the computer to manage powerconservation and computer power. These adjustments are accomplishedwithin the CPU cycles and do not affect the user's perception ofperformance.

Thus, when the operator for the third party software of the operatingsystem/BIOS is not using the computer, the present invention will effecta quick turn off or slow down of the CPU until needed, thereby reducingthe power consumption, and will promptly restore full CPU operation whenneeded without affecting perceived performance. This switching back intofull operation from the “slow down” mode occurs without the user havingto request it and without any delay in the operation of the computerwhile waiting for the computer to return to a “ready” state.

These and other features and advantages of the invention will beapparent to those skilled in the art from the following detaileddescription of a preferred embodiment, taken together with theaccompanying drawings, in which:

DESCRIPTION OF THE DRAWINGS

FIG. 1 is a flowchart depicting the self-tuning aspect of a referredembodiment of the present invention;

FIGS. 2 a-2 d are flowcharts depicting the active power conservationmonitor employed by the present invention;

FIG. 3 is a simplified schematic diagram representing the active powerconservation associated hardware employed by the present invention;

FIG. 4 is a schematic of the sleep hardware for one embodiment of thepresent invention; and

FIG. 5 is a schematic of the sleep hardware for another embodiment ofthe present invention.

DETAILED DESCRIPTION OF A PREFERRED EMBODIMENT

If the period of computer activity in any given system is examined, theCPU and associated components have a utilization percentage. If the useris inputing data from the keyboard, the time between keystrokes is verylong in terms of CPU cycles. Many things can be accomplished by thecomputer during this time, such as printing a report. Even during theprinting of a report, time is still available for additional operationssuch as background updating of a clock/calendar display. Even so, thereis almost always spare time when the CPU is not being used. If thecomputer is turned off or slowed down during this spare time, then powerconsumption is obtained real-time. Such real-time power conservationextends battery operation life.

According to the preferred embodiment of the present invention, toconserve power under MS-DOS, as well as other operating systems such asOS/2, XENIX, and those for Apple computers, requires a combination ofhardware and software. It should be noted that because the presentinvention will work in any system, while the implementation may varyslightly on a system-by-system basis, the scope of the present inventionshould therefore not be limited to computer systems operating underMS/DOS.

Slowing down or stopping the computer system components according to thepreferred embodiment of the present invention, reduces powerconsumption, although the amount of power saved may vary. Therefore,according to the present invention, stopping the clock (where possibleas some CPUs cannot have their clocks stopped) reduces the powerconsumption more than just slowing the clock.

In general, the number of operations (or instructions) per second may beconsidered to be roughly proportional to the processor clock:instructions/second=instructions/cycle*cycles/secondAssuming for simplicity that the same instruction is repeatedly executedso that instructions/second is constant, the relationship can beexpressed as follows:Fq=K ₁*Clkwhere Fq is instructions/second, K₁ is constant equal to theinstructions/cycle, and Clk equals cycles/second. Thus, roughlyspeaking, the rate of execution increases with the frequency of the CPUclock.

The amount of power being used at any given moment is also related tothe frequency of the CPU clock and therefore to the rate of execution.In general this relationship can be expressed as follows:P=K ₂−(K ₃*Clk)where P is power in watts, K₂ is a constant in watts, K₃ is a constantand expresses the number of watt-seconds/cycle, and Clk equals thecycles/second of the CPU clock. Thus it can also be said that the amountof power being consumed at any given time increases as the CPU clockfrequency increases.

Assume that a given time period T is divided into N intervals such thatthe power P is constant during each interval. Then the amount of energyE expended during T is given by:E=P(1)deltaT ₁ +P(2)deltaT ₂ . . . +P(N)deltaT _(N)Further assume that the CPU clock “Clk” has only two states, either “ON”or “OFF”. For the purposes of this discussion, the “ON” state representsthe CPU clock at its maximum frequency, while the “OFF” state representsthe minimum clock rate at which the CPU can operate (this may be zerofor CPUs that can have their clocks stopped). For the condition in whichthe CPU clock is always “ON”, each P(i) in the previous equation isequal and the total energy is:

$\begin{matrix}{{E\left( \max \right)} = {{P({on})}*\left( {{{delta}\mspace{14mu} T_{1}} + {{delta}\mspace{14mu} T_{2}\mspace{20mu}\ldots} + {{delta}{\mspace{11mu}\mspace{11mu}}T_{N}}} \right)}} \\{= {{P({on})}*T}}\end{matrix}$

This represents the maximum power consumption of the computer in whichno power conservation measures are being used. If the CPU clock is “off”during a portion of the intervals, then there are two power levelspossible for each interval. The P(on) represents the power beingconsumed when the clock in its “ON” state, while P(off) represents thepower being used when the clock is “OFF”. If all of the time intervalsin which the clock is “ON” is summed into the quantity “T(on)” and the“OFF” intervals are summed into “T(off)”, then it follows:T=T(on)+T(off)Now the energy being used during period T can be written:E=[P(on)*T(on)]+[P(off)*T(off)]Under these conditions, the total energy consumed may be reduced byincreasing the time intervals T(off). Thus, by controlling the periodsof time the clock is in its “OFF” state, the amount of energy being usedmay be reduced. If the T(off) period is divided into a large number ofintervals during the period T, then as the width of each interval goesto zero, energy consumption is at a maximum. Conversely, as the width ofthe T(off) intervals increase, the energy consumed decreases.

If the “OFF” intervals are arranged to coincide with periods duringwhich the CPU is normally inactive, then the user cannnot perceive anyreduction in performance and overall energy consumption is reduced fromthe E(max) state. In order to align the T(off) intervals with periods ofCPU inactivity, the CPU activity level is used to determine the width ofthe T(off) intervals in a closed loop. FIG. 1 depicts such a closedloop. The activity level of the CPU is determined at Step 10. If thislevel is an increase over an immediately previous determination, thepresent invention decreases the T(off) interval (Step 20) and returns todetermine the activity level of the CPU again. If, on the other hand,this activity level is a decrease over an immediately previousdetermination, the present invention increases the T(off) interval (Step30) and proceeds to again determine the activity level of the CPU. Thusthe T(off) intervals are constantly being adjusted to match the systemactivity level.

In any operating system, two key logic points exist: an IDLE, or “donothing”, loom within the operating system and an operating systemrequest channel, usually available for services needed by theapplication software. By placing logic inline with these logic points,the type of activity request made by an application software can beevaluated, power conservation can be activated and slice periodsdetermined. A slice period is the number of T(on) vs. T(off) intervalsover time, computed by the activity level. An assumption may be made todetermine CPU activity level: Software programs that need serviceusually need additional services and the period of time between servicerequests can be used to determine the activity level of any applicationsoftware running on the computer and to provide slice counts for powerconservation according to the present invention.

Once the CPU is interrupted during a power conservation slice (T(off)),the CPU will save the interrupted routine's state prior to vectoring tothe interrupt software. Of course, since the power conservation softwarewas operating during this slice, control will be returned to the activepower conservation loop (monitor 40) which simply monitors the CPU'sclock to determine an exit condition for the power conservation mode,thereby exiting from T(off) to T(on) state. The interval of the nextpower conservation state is adjusted by the activity level monitored, asdiscussed above in connection with FIG. 1. Some implementations cancreate an automatic exit from T(off) by the hardware logic, therebyforcing the power conservation loop to be exited automatically andexecuting an interval T(on).

More specifically, looking now at FIGS. 2 a-2 d, which depict the activepower conservation monitor 40 of the present invention. The CPU installsmonitor 40 either via a program stored in the CPU ROM or loads it froman external device storing the program in RAM. Once the CPU has loadedmonitor 40, it continues to INIT 50 for system interrupt initialization,user configurational setup, and system/application specificinitialization. IDLE branch 60 (more specifically set out in FIG. 2 b)is executed by a hardware or software interrupt for an IDLE or “donothing” function. This type of interrupt is caused by the CPU enteringeither an IDLE or a “do nothing” loop (i.e., planned inactivity). TheACTIVITY branch 70 of the flowchart, more fully described below inrelation to FIG. 2 d, is executed by a software or hardware interruptdue to an operating system or I/O service request, by an applicationprogram or internal operating system function. An I/O service requestmade by a program may, for example, be a disk I/O, read, print, load,etc. Regardless of the branch selected, control is eventually returnedto the CPU operating system at RETURN 80. The INIT branch 50 of thisflowchart, shown in FIG. 2 a, is executed only once if it is loaded viaprogram into ROM or is executed every time during power up if it isloaded from an external device and stored in the RAM. Once this branchof active power monitor 40 has been fully executed, whenever control isyielded from the operating system to the power conservation mode, eitherIDLE 60 or ACTIVITY 70 branches are selected depending on the type ofCPU activity: IDLE branch 60 for power conservation during plannedinactivity and ACTIVITY branch 70 for power conservation during CPUactivity.

Looking more closely at INIT branch 50, after all system interrupt andvariables are initialized, the routine continues at Step 90 to set thePower_level equal to DEFAULT_LEVEL. In operating systems where the userhas input control for the Power_level, the program at Step 100 checks tosee if a User_level has been selected. If the User_level is less thanzero or greater than the MAXIMUM_LEVEL, the system uses theDEFAULT_LEVEL. Otherwise, it continues onto Step 110 where it modifiesthe Power_level to equal the User_level.

According to the preferred embodiment of the present invention, thesystem am Step 120 sets the variable Idle_tick to zero and the variableActivity_tick to zero. Under an MS/DOS implementation, Idle_tick refersto the number of interrupts found in a “do nothing” loop. Activity_tickrefers to the number of interrupts caused by an activity interrupt whichin turn determines the CPU activity level. Tick count represents a deltatime for the next interrupt. Idle_tick is a constant delta time from onetick to another (interrupt) unless overwritten by a software interrupt.A software interrupt may reprogram delta time between interrupts.

After setting the variables to zero, the routine continues on to Setup130 at which time any application specific configuration fine-tuning ishandled in terms of system-specific details and the system isinitialized. Next the routine arms the interrupt I/O (Step 140) withinstructions to the hardware indicating the hardware can take control atthe next interrupt. INIT branch 50 then exits to the operating system,or whatever called the active power monitor originally, at RETURN 80.

Consider now IDLE branch 60 of active power monitor 40, more fullydescribed at FIG. 2 b. In response to a planned inactivity of the CPU,monitor 40 (not specifically shown in this Figure) checks to see ifentry into IDLE branch 60 is permitted by first determining whether theactivity interrupt is currently busy. If Busy_A equals BUSY_FLAG (Step150), which is a reentry flag, the CPU is busy and cannot now be put tosleep. Therefore, monitor 40 immediately proceeds to RETURN I 160 andexits the routine. RETURN I 160 is an indirect vector to the previousoperating system IDLE vector interrupt for normal processing storedbefore entering monitor 40. (I.e., this causes an interrupt return tothe last chained vector.)

If the Busy_A interrupt flag is not busy, then monitor 40 checks to seeif the Busy_Idle interrupt flag, Busy_I, equals BUSY_FLAG (Step 170). Ifso, this indicates the system is already in IDLE branch 60 of monitor 40and therefore the system should not interrupt itself. IfBusy_I=BUSY_FLAG, the system exits the routine at RETURN I indirectvector 160.

If, however, neither the Busy_A reentry flag or the Busy_I reentry flaghave been set, the routine sets the Busy_I flag at Step 180 for reentryprotection (Busy_I=BUSY_FLAG). At Step 190 Idle_tick is incremented byone. Idle_tick is the nether of T(on) before a T(off) interval and isdetermined from IDLE interrupts, setup interrupts and from CPU activitylevel. Idle_tick increments by one to allow for smoothing of events,thereby letting a critical I/O activity control smoothing.

At Step 200 monitor 40 checks to see if Idle_tick equals IDLE_MAXTICKS.IDLE_MAXTICKS is one of the constants initialized in Setup 130 of INITbranch 50, remains constant for a system, and is responsible forself-tuning of the activity level. If Idle_tick does not equalIDLE_MAXTICKS, the Busy_I flag is cleared at Step 210 and exits the loopproceeding to the RETURN I indirect vector 160. If, however, Idle_tickequals IDLE_MAXTCKS, Idle_tick is set equal to IDLE_START_TICKS (Step220). IDLE_START_TICKS is a constant which may or may not be zero(dpending on whether the particular CPU can have its clock stopped).This step determines the self-tuning of how often the rest of the sleepfunctions may be performed. By setting IDLE_START_TICKS equal toIDLE_MAXTICKS minus one, a continuous T(off) interval is achieved. AtStep 230, the Power_level is checked. If it is equal to zero, themonitor clears the Busy_I flag (Step 210), exits the routine at RETURN I160, and returns control to the operating system so it may continue whatit was originally doing before it entered active power monitor 40.

If however, the Power_level does not equal zero at Step 240, the routinedetermines whether an interrupt mask is in place. An interrupt mask isset by the system/application software, and determines whetherinterrupts are available to monitor 40. If interrupts are NOT_AVAILABLE,the Busy_I reentry flag is cleared and control is returned to theoperating system to continue what it was doing before it entered monitor40. Operating systems, as well as application software, can set T(on)interval to yield a continuous T(on) state by setting the interrupt maskequal to NOT_AVAILABLE.

Assuming an interrupt is AVAILABLE, monitor 40 proceeds to the SAVEPOWER subroutine 250 which is fully executed during one T(off) periodestablished by the hardware state. (For example, in the preferredembodiment of the present invention, the longest possible interval couldbe 18 ms, which is the longest time between two ticks or interrupts fromthe real-time clock.) During the SAVE POWER subroutine 250, the CPUclock is stepped down to a sleep clock level.

Once a critical I/O operation forces the T(on) intervals, the IDLEbranch 60 interrupt tends to remain ready for additional critical I/Orequests. As the CPU becomes busy with critical I/O, less T(off)intervals are available. Conversely, as critical I/O requests decrease,and the time intervals between them increase, more T(off) intervals areavailable. IDLE branch 60 is a self-tuning system based on feedback fromactivity interrupts and tends to provide more T(off) intervals as theactivity level slows. As soon as monitor 40 has completed SAVE POWERsubroutine 250, shown in FIG. 2 c and more fully described below, theBusy_I reentry flag is cleared (Step 210) and control is returned atRETURN I 160 to whatever operating system originally requested monitor40.

Consider now FIG. 2 c, which is a flowchart depicting the SAVE POWERsubroutine 250. Monitor 40 determines what the I/O hardware high speedclock is a: Step 260. It sets the CURRENT_CLOCK_RATE equal to therelevant high speed clock and saves this value to be used for CPUs withmultiple level high speed clocks. Thus, if a particular CPU has 12 MHzand 6 MHz high speed clocks, monitor 40 must determine which high speedclock the CPU is at before monitor 40 reduces power so it mayreestablish the CPU at the proper high speed clock when the CPU awakens.At Step 270, the Save_clock_rate is set equal to the CURRENT_CLOCK_RATEdetermined. Save_clock_rate 270 is not used when there is only one highspeed clock for the CPU. Monitor 40 now continues to SLEEPCLOCK 280,where a pulse is sent to the hardware selector (shown in FIG. 3) to putthe CPU clock to sleep (i.e., lower or stop its clock frequency). TheI/O port hardware sleep clock is at much lower oscillations than the CPUclock normally employed.

At this point either of two events can happen. A system/applicationinterrupt may occur or a real-time clock interrupt may occur. If asystem/application interrupt 290 occurs, monitor 40 proceeds tointerrupt routine 300, processing the interrupt as soon as possible,arming interrupt I/O at Step 310, and returning to determine whetherthere has been an interrupt (Step 320). Since in this case there hasbeen an interrupt, the Save_clock_rate is used (Step 330) to determinewhich high speed clock to return the CPU to and SAVE POWER subroutine250 is exited at RETURN 340. If, however, a system/application interruptis not received, the SAVE POWER subroutine 250 will continue to waituntil a real-time clock interrupt has occurred (Step 320). Once such aninterrupt has occurred, SAVE POWER subroutine 250 reestablishes the CPUat the stored Save-clock-rate. If the sleep clock rate was not stopped,in other words, the sleep clock rate was not zero, control is passed ata slow clock and SAVE POWER subroutine 250 will execute interrupt loop320 several times. If however, control is passed when the sleep clockrate was zero, in other words, there was no clock, the SAVE POWERsubroutine 250 will execute interrupt loop 320 once before returning theCPU clock to the Save_clock_rate 330 and exiting (Step (340).

Consider now FIG. 2 d which is a flowchart showing ACTIVITY branch 70triggered by an application/system activity request via an operatingsystem service request interrupt. ACTIVITY branch 70 begins with reentryprotection. Monitor 40 determines at Step 350 whether Busy_I has beenset to BUSY_FLAG. If it has, this means the system is already in IDLEbranch 60 and cannot be interrupted. If Busy_I=BUSY_FLAG, monitor 40exits to RETURN I 160, which is an indirect vector to an old activityvector interrupt for normal processing, via an interrupt vector afterthe operating system performs the requested service.

If however, the Busy_I flag does not equal BUSY_FLAG, which means IDLEbranch 60 is not being accessed, monitor 40 determines at Step 360 ifthe BUSY_A flag has been set equal to BUSY_FLAG. If so, control will bereturned to the system at this point because ACTIVITY branch 70 isalready being used and cannot be interrupted. If the Busy_A flag has notbeen set, in other words, Busy_A does not equal BUSY_FLAG, monitor 40sets Busy_A equal to BUSY_FLAG at Step 370 so as not to be interruptedduring execution of ACTIVITY branch 70. At Step 380 the Power_level isdetermined. If Power_level equals zero, monitor 40 exits ACTIVITY branch70 after clearing the Busy_A reentry flag (Step 390). If however, thePower_level does not equal zero, the CURRENT_CLOCK_RATE of the I/Ohardware is next determined. As was true with Step 270 of FIG. 2C, Step400 of FIG. 2 d uses the CURRENT_CLOCK_RATE if there are multiple levelhigh speed clocks for a given CPU. Otherwise, CURRENT_CLOCK_RATE alwaysequals the CPU high speed clock. After the CURRENT_CLOCK_RATE isdetermined (Step 400), at Step 410 Idle_tick is set equal to theconstant START_TICKS established for the previously determinedCURRENT_CLOCK_RATE. T(off) intervals are established based on thecurrent high speed clock that is active.

Monitor 40 next determines that a request has been made. A request is aninput by the application software running on the computer, for aparticular type of service needed. At Step 420, monitor 40 determineswhether the request is a CRITICAL I/O. If the request is a CRITICAL I/O,it will continuously force T(on) to lengthen until the T(on) is greaterthan the T(off), and monitor 40 will exit ACTIVITY branch 70 afterclearing the Busy_A reentry flag (Step 390). If, on the other hand, therequest is not a CRITICAL I/O, then the Activity_tick is incremented byone at Step 430. It is then determined at Step 440 whether theActivity_tick now equals ACTIVITY_MAXTICKS. Step 440 allows a smoothingfrom a CRITICAL I/O, and makes the system ready from another CRITICALI/O during Activity_tick T(on) intervals. Assuming Activity_tick doesnot equal ACTIVITY_MAXTICKS, ACTIVITY branch 70 is exited after clearingthe Busy_A reentry flag (Step 390). If, on the other hand, theActivity_tick equals constant ACTIVITY_MAXTICKS, at Step 450Activity_tick is set to the constant LEVEL_MAXTICKS established for theparticular Power_level determined at Step 380.

Now monitor 40 determines whether an interrupt mask exists (Step 460).An interrupt mask is set by system/application software. Setting it toNOT_AVAILABLE creates a continuous T(on) state. If the interrupt maskequals NOT_AVAILABLE, there are no interrupts available at this time andmonitor 40 exits ACTIVITY branch 70 after clearing the Busy_A reentryflag (Step 390). If, however, an interrupt is AVAILABLE, monitor 40determines at Step 470 whether the request identified at Step 420 wasfor a SLOW I/O_INTERRUPT. SLOW I/O requests may have a delay until theI/O device becomes “ready”. During the “make ready” operation, acontinuous T(off) interval may be set up and executed to conserve power.Thus, if the request is not a SLOW I/O_INTERRUPT, ACTIVITY branch 70 isexited after clearing the Busy_A reentry flag (Step 390). If, however,the request is a SLOW I/O_INTERRUPT, and time yet exists before the I/Odevice becomes “ready”, monitor 40 then determines at Step 480 whetherthe I/O request is COMPLETE (i.e., is I/O device ready?). If the I/Odevice is not ready, monitor 40 forces T(off) to lengthen, therebyforcing the CPU to wait, or sleep, until the SLOW I/O device is ready.At this point it has time to save power and ACTIVITY branch 70 entersSAVE POWER subroutine 250 previously described in connection with toFIG. 2C. If, however, the I/O request is COMPLETE, control is returnedto the operating system subsequently to monitor 40 exiting ACTIVITYbranch 70 after clearing Busy_A reentry flag (Step 390).

Self-tuning is inherent within the control system of continuous feedbackloops. The software of the present invention can detect when CPUactivity is low and therefore when the power conservation aspect of thepresent invention may be activated. Once the power conservation monitoris activated, a prompt return to full speed CPU clock operation withinthe interval is achieved so as to not degrade the performance of thecomputer. To achieve this prompt return to full speed CPU clockoperation, the preferred embodiment of the present invention employssome associated hardware.

Looking now at FIG. 3 which shows a simplified schematic diagramrepresenting the associated hardware employed by the present inventionfor active power conservation. When monitor 40 (not shown) determinesthe CPU is ready to sleep, it writes to an I/O port (not shown) whichcauses a pulse on the SLEEP line. The rising edge of this pulse on theSLEEP line causes flip flop 500 to clock a high to Q and a low to Q−.This causes the AND/OR logic (AND gates 510, 520, OR gate 530) to selectthe pulses traveling the SLEEP CLOCK line from SLEEP CLOCK oscillator540 to be sent to and used by the CPU CLOCK. SLEEP CLOCK oscillator 540is a slower clock than the CPU clock used during normal CPU activity.The high coming from the Q of flip flop 500 ANDed (510) with the pulsescoming from SLEEP CLOCK oscillator 540 is ORed (530) with the result ofthe low on the Q− of flip flop 500 ANDed (520) with the pulse generatedalong the HIGH SPEED CLOCK line by the HIGH SPEED CLOCK oscillator 550to yield the CPU CLOCK. When the I/O port designates SLEEP CLOCK, theCPU CLOCK is then equal to the SLEEP CLOCK oscillator 540 value. If, onthe other hand, an interrupt occurs, an interrupt—value clears flip flop500, thereby forcing the AND/OR selector (comprising 510, 520 and 530)to choose the HIGH SPEED CLOCK value, and returns the CPU CLOCK value tothe value coming from HIGH SPEED CLOCK oscillator 550. Therefore, duringany power conservation operation on the CPU, the detection of anyinterrupt within the system will restore the CPU operation at full clockrate prior to vectoring and processing the interrupt.

It should be nosed that the associated hardware needed, external to eachof the CPUs for any given system, may be different based on theoperating system used, whether the CPU can be stopped, etc.Nevertheless, the scope of the present invention should not be limitedby possible system specific modifications needed to permit the presentinvention to actively conserve power in the numerous available portablecomputer systems. For example two actual implementations are shown inFIGS. 4 and 5, discussed below.

Many VSLI designs today allow for clock switching of the CPU speed. Thelogic to switch from a null clock or slow clock to a fast clock logic isthe same as that which allows the user to change speeds by a keyboardcommand. The added logic of monitor 40 working with such switchinglogic, causes an immediate return to a fast clock upon detection of anyinterrupt. This simple logic is the key to the necessary hardwaresupport to interrupt the CPU and thereby allow the processing of theinterrupt at full speed.

The method to reduce power consumption under MS-DOS employs the MS-DOSIDLE loop trap to gain access to the “do nothing” loop. The IDLE loopprovides special access to application software and operating systemoperations that are in a state of IDLE or low activity. Carefulexamination is required to determine the activity level at any givenpoint within the system. Feedback loops are used from the interrupt 21Hservice request to determine the activity level. The prediction ofactivity level is determined by interrupt 21H requests, from which thepresent invention thereby sets the slice periods for “sleeping” (slowingdown or stopping) the CPU. An additional feature allows the user tomodify the slice depending on the activity level of interrupt 21H.

Looking now at FIG. 4, which depicts a schematic of an actual sleephardware implementation for a system such as the Intel 80386 (CPU cannothave its clock stopped). Address enable bus 600 and address bus 610provide CPU input to demultiplexer 620. The output of demultiplexer 620is sent along SLEEPCS- and provided as input to OR gates 630,640. Theother inputs to OR gates 630,640 are the I/O write control line and theI/O read control line, respectively. The outputs of these gates, inaddition to NOR gate 650, are applied to D flip flop 660 to decode theport. “INTR” is the interrupt input from the I/O port (peripherals) intoNOR gate 650, which causes the logic hardware to switch back to the highspeed clock. The output of flip flop 660 is then fed, along with theoutput from OR gate 630, to tristate buffer 670 to enable it to readback what is on the port. All of the above-identified hardware is usedby the read/write I/O port (peripherals) to select the power saving“Sleep” operation. The output “SLOW-” is equivalent to “SLEEP” in FIG.2, and is inputted to flip flop 680, discussed later.

The output of SLEEP CLCCK oscillator 690 is divided into two slowerclocks by D flip flops 700,710. In the particular implementation shownin FIG. 4, 16 MHz sleep clock oscillator 690 is divided into 4 MHz and 8MHz clocks. Jumper J1 selects which clock is to be the “SLEEP CLOCK”.

In this particular implementation, high speed clock oscillator 720 is a32 MHz oscillator, although this particular speed is not a requirementof the present invention. The 32 MHz oscillator is put in series with aresistor (for the implementation shown, 33 ohms), which is in serieswith two parallel capacitors (10 pF). The result of such oscillations istied to the clocks of D flip flops 730,740.

D flip flops 680,730,740 are synchronizing flip flops; 680,730 were notshown in the simplified sleep hardware of FIG. 2. These flip flops areused to ensure the clock switch occurs only on clock edge. As can beseen in FIG. 4, as with flip flop 500 of FIG. 2, the output of flip flop740 either activates OR gate 750 or OR gate 760, depending upon whetherthe CPU is to sleep (“FASTEN-”) or awaken (“SLOWEN-”).

OR gates 750,750 and AND gate 770 are the functional equivalents to theAND/OR selector of FIG. 2. They are responsible for selecting either the“slowclk” (slow clock, also known as SLEEP CLOCK) or high speed clock(designated as 32 MHz on the incoming line). In this implementation, theSlow clock is either 4 MHz or 8 MHz, depending upon jumper J1, and thehigh speed clock is 32 MHz. The output of AND gate 770 (ATUCLK)establishes the rate of the CPU clock, and is the equivalent of CPUCLOCK of FIG. 2.

Consider now FIG. 5, which depicts a schematic of another actual sleephardware implementation for a system such as the Intel 80286 (CPU canhave its clock stopped). The Western Digital FE3600 VLSI is used for thespeed switching with a special external PAL 780 to control the interruptgating which wakes up the CPU on any interrupt. The software powerconservation according to the present invention monitors the interruptacceptance, activating the next P(i)deltaT_(i) interval after theinterrupt.

Any interrupt request to the CPU will return the system to normaloperation. An interrupt request (“INTRQ”) to the CPU will cause the PALto issue a Wake Up signal on the RESCPU line to the FE3001 (not shown)which in turn enables the CPU and the DMA clocks to bring the systemback to its normal state. This is the equivalent of the “INTERRUPT-” ofFIG. 2. Interrupt Request is synchronized to avoid confusing the statemachine so that Interrupt (INTDET) will only be detected while the cycleis active. The rising edge of RESCPU will wake up the FE 3001 which inturn releases the whole system from the Sleep Mode.

Implementation for the 386SX is different only in the external hardwareand software power conservation loop. The software loop will setexternal hardware to switch to the high speed clock on interrupt priorto vectoring the interrupt. Once return is made to the powerconservation software, the high speed clock cycle will be detected andthe hardware will be reset for full clock operation.

Implementation for OS/2 uses the “do nothing” loop programmed as aTHREAD running in background operation with low priority. Once theTHREAD is activated, the CPU sleep, or low speed clock, operation willbe activated until an interrupt occurs thereby placing the CPU back tothe original clock rate.

Although interrupts have been employed to wake up the CPU in thepreferred embodiment of the present invention, it should be realizedthat any periodic activity within the system, or applied to the system,could also be used for the same function.

While several implementations of the preferred embodiment of theinvention has been shown and described, various modifications andalternate embodiments will occur to those skilled in the art.Accordingly, it is intended that the invention be limited only in termsof the appended claims.

We claim:
 1. A processor, comprising: a monitor for measuring idle timewithin said processor, results of said measuring being used by saidprocessor for determining which, of at least two clock signals, shouldbe used by said processor.
 2. A processor, comprising: a monitor formeasuring activity time within said processor, results of said measuringbeing used by said processor for determining which, of at least twoclock signals, should be used by said processor.
 3. A processor,comprising: a monitor for measuring idle time and activity time withinsaid processor, results of said measuring being used by said processorfor determining which, of at least two clock signals, should be used bysaid processor.